import { Body, Controller } from '@nestjs/common';
import { MenuService } from './menu.service';
import { Get, Post } from '@nestjs/common';
import { SaveMenuDto } from './dto/saveMenu.dto';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';

@Controller('menu')
export class MenuController {
  constructor(private readonly menuService: MenuService) {}

  @Get('list')
  @ApiOperation({ summary: '获取菜单列表' })
  @ApiResponse({
    status: 200,
    description: '返回菜单列表',
  })
  getMenuList() {
    return this.menuService.getMenuList();
  }

  @Post('save')
  @ApiOperation({ summary: '保存菜单' })
  @ApiResponse({
    status: 200,
    description: '返回保存的菜单',
  })
  saveMenu(@Body() menu: SaveMenuDto) {
    return this.menuService.saveMenu(menu);
  }
}
